﻿
using System.Collections.Generic;
namespace NClass.StubLanguage
{
	public class StubLanguage : Core.Language
	{
		static StubLanguage()
		{
			instance = new StubLanguage();
			_accessModifiers = new Dictionary<Core.AccessModifier, string>();
			_classModifiers = new Dictionary<Core.ClassModifier, string>();
			_fieldModifiers = new Dictionary<Core.FieldModifier, string>();
			_opModifiers = new Dictionary<Core.OperationModifier, string>();

			foreach (Core.AccessModifier modifier in System.Enum.GetValues(typeof(Core.AccessModifier)))
				_accessModifiers.Add(modifier, modifier.ToString());

			foreach (Core.ClassModifier modifier in System.Enum.GetValues(typeof(Core.ClassModifier)))
				_classModifiers.Add(modifier, modifier.ToString());

			foreach (Core.FieldModifier modifier in System.Enum.GetValues(typeof(Core.FieldModifier)))
				_fieldModifiers.Add(modifier, modifier.ToString());

			foreach (Core.OperationModifier modifier in System.Enum.GetValues(typeof(Core.OperationModifier)))
				_opModifiers.Add(modifier, modifier.ToString());
		}

		private static readonly StubLanguage instance;

		public static StubLanguage Instance
		{
			get { return instance; }
		}

		private StubLanguage()
		{
		}

		public override string Name
		{
			get { return "Stub"; }
		}

		public override string AssemblyName
		{
			get { return "Stub"; }
		}

		private static readonly Dictionary<Core.AccessModifier, string> _accessModifiers;
		private static readonly Dictionary<Core.ClassModifier, string> _classModifiers;
		private static readonly Dictionary<Core.FieldModifier, string> _fieldModifiers;
		private static readonly Dictionary<Core.OperationModifier, string> _opModifiers;

		public override Dictionary<Core.AccessModifier, string> ValidAccessModifiers { get { return _accessModifiers; } }

		public override Dictionary<Core.ClassModifier, string> ValidClassModifiers { get { return _classModifiers; } }

		public override Dictionary<Core.FieldModifier, string> ValidFieldModifiers { get { return _fieldModifiers; } }

		public override Dictionary<Core.OperationModifier, string> ValidOperationModifiers { get { return _opModifiers; } }

		public override bool SupportsAssemblyImport { get { return false; } }

		public override bool SupportsInterfaces { get { return false; } }

		public override bool SupportsStructures { get { return false; } }

		public override bool SupportsEnums { get { return false; } }

		public override bool SupportsDelegates { get { return false; } }

		public override bool SupportsExplicitImplementation { get { return false; } }

		public override bool ExplicitVirtualMethods { get { return false; } }

		public override string DefaultFileExtension { get { return ".stubd"; } }

		protected override string[] ReservedNames { get { return new string[0]; } }

		protected override string[] TypeKeywords { get { return new string[0]; } }

		protected override Core.Operation Implement(Core.Operation operation, Core.CompositeType newParent, bool explicitly)
		{
			throw new System.NotImplementedException();
		}

		protected override Core.Operation Override(Core.Operation operation, Core.CompositeType newParent)
		{
			throw new System.NotImplementedException();
		}

		public override bool IsValidModifier(Core.FieldModifier modifier)
		{
			return _fieldModifiers.ContainsKey(modifier);
		}

		public override bool IsValidModifier(Core.OperationModifier modifier)
		{
			return _opModifiers.ContainsKey(modifier);
		}

		public override bool IsValidModifier(Core.AccessModifier modifier)
		{
			return _accessModifiers.ContainsKey(modifier);
		}

		protected override void ValidateOperation(Core.Operation operation)
		{
			// Do nothing
		}

		protected override void ValidateField(Core.Field field)
		{
			// Do nothing
		}

		protected override Core.ClassType CreateClass()
		{
			return new StubClass();
		}

		protected override Core.StructureType CreateStructure()
		{
			return new StubStructure();
		}

		protected override Core.InterfaceType CreateInterface()
		{
			return new StubInterface();
		}

		protected override Core.EnumType CreateEnum()
		{
			return new StubEnum();
		}

		protected override Core.DelegateType CreateDelegate()
		{
			return new StubDelegate();
		}

		protected override Core.ArgumentList CreateParameterCollection()
		{
			return new StubArgumentList();
		}

		public override string GetAccessString(Core.AccessModifier access, bool forCode)
		{
			return access.ToString();
		}

		public override string GetFieldModifierString(Core.FieldModifier modifier, bool forCode)
		{
			return modifier.ToString();
		}

		public override string GetOperationModifierString(Core.OperationModifier modifier, bool forCode)
		{
			return modifier.ToString();
		}

		public override string GetClassModifierString(Core.ClassModifier modifier, bool forCode)
		{
			return modifier.ToString();
		}
	}
}
